import redis
from config import cfg

class openR :
   def __init__(self,ip = cfg.redis_ip) :
      self.ip = ip
      self.pool = redis.ConnectionPool(host=self.ip, port=cfg.redis_prot,decode_responses=True)
      self.r =  redis.Redis(connection_pool=self.pool)

   def opean_redis_get(self,k):
      return self.r.get(k)
   
   def opean_redis_set(self,k,v):
      return self.r.set(k,v)

   def operat_redis_hset(self,n,k,v):
      return self.r.hset(n,k,v)
   
   def operat_redis_hget(self,n,k):
      return self.r.hget(n,k)
   
   def operat_redis_hexists(self,n,k):
      return self.r.hexists(n,k)